package com.primus.server.entity.store;

import com.google.common.collect.Lists;
import com.primus.server.entity.BaseEntity;
import com.primus.server.entity.FileEntity;
import lombok.Getter;
import lombok.Setter;

import javax.persistence.*;
import java.util.List;

@Entity
@Getter
@Setter
public class Product extends BaseEntity {

    private String name;

    private Double price;

    private String type;

    @OneToMany(fetch = FetchType.LAZY, cascade = CascadeType.ALL, orphanRemoval = true)
    private List<FileEntity> photos = Lists.newArrayList();

    @OneToMany(fetch = FetchType.LAZY, cascade = CascadeType.ALL, orphanRemoval = true)
    private List<Comment> comments = Lists.newArrayList();

    @ManyToOne
    private Store store;
}
